package com.panshi.api;

import com.panshi.vo.qa.DataResultQA;
import com.panshi.vo.qa.Pages;
import com.panshi.vo.qa.Question;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

@FeignClient(value = "qa-server",contextId = "question-api")
public interface IQuestionApi {
    /*IQuestionApi(问题Api)*/

    /**
     * 问题分页查询
     * @param pages
     * @return
     */
    @PostMapping("/question/inquirePages")
    @ResponseBody
    DataResultQA<Pages<Question>> inquirePagesQuestion(@RequestBody Pages pages);

    /**
     * 查询记录总数
     * @param pages
     * @return
     */
    @PostMapping("/inquireQuestionSum")
    @ResponseBody
    DataResultQA<Integer> inquireQuestionSum(@RequestBody Pages pages);

    /**
     * 问题根据id查询
     * @param id
     * @return
     */
    @PostMapping("/question/inquireById/{id}")
    @ResponseBody
    DataResultQA<Question> inquireByIdQuestion(@PathVariable int id);

    /**
     * 问题收藏总数加一
     * @param id
     * @return
     */
    @GetMapping("/question/collectSumAnd1/{id}")
    @ResponseBody
    DataResultQA collectSumAnd1_Question(@PathVariable int id);

    /**
     * 收藏总数减一
     * @param id
     * @return
     */
    @GetMapping("/question/collectSumSubtract1/{id}")
    @ResponseBody
    DataResultQA collectSumSubtract1_Question(@PathVariable int id);

    /*//回答总数加一
    @GetMapping("/commentSumAnd1/{id}")
    @ResponseBody
    boolean commentSumAnd1_Question(int id);*/

    /**
     * 回答总数减一
     * @param id
     * @return
     */
    @GetMapping("/question/commentSumSubtract1/{id}")
    @ResponseBody
    DataResultQA commentSumSubtract1_Question(@PathVariable int id);

    /**
     * 问题标记删除
     * @param id
     * @return
     */
    @GetMapping("/question/delete/{id}")
    @ResponseBody
    DataResultQA deleteQuestion(@PathVariable int id);

    /**
     * 用于用户查询自己发布的问题(分页查询)
     * @param pages
     * @return
     */
    @PostMapping("/question/inquireMyPagesQuestion")
    @ResponseBody
    DataResultQA<Pages<Question>> inquireMyPagesQuestion(@RequestBody Pages pages);
}
